package com.grm.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.grm.common.Result;
import com.grm.entity.Brand;
import com.grm.enums.CodeMessageEnum;
import com.grm.service.BrandService;

@RestController
@RequestMapping("/brand")
public class BrandController {
	private static Logger logger = LoggerFactory.getLogger(BrandController.class);
	
	@Autowired
	private BrandService brandService;
	
	/**
	 * desc: 通过查询商品接口，测试异步调用方法
	 *
	 * @param user
	 * @return
	 */
	@GetMapping("/query/list")
	public Result queryBrands() {
		List<Brand> brands = brandService.queryBrands();
		logger.info("[BrandController] queryBrands success,user = {}",JSON.toJSONString(brands));
		return Result.success(CodeMessageEnum.SUCCESS.getMessage(),brands);
	}
}
